package xjtu.zd.server.staff.chapter.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import xjtu.zd.server.common.Classification;
import xjtu.zd.server.staff.chapter.Chapter;
import xjtu.zd.server.staff.chapter.ChapterDto;
import xjtu.zd.server.staff.chapter.EditDto;
import xjtu.zd.server.staff.chapter.SearchDto;

import java.util.List;

public interface ChapterDao {

    List<Chapter> findChapterList(SearchDto dto);

    @Update("update t_chapter set ch_status=#{ch_status},ch_edit_comment=#{ch_edit_comment} where ch_id=#{ch_id}")
    void updChapter(EditDto dto);

    @Select("select txt from t_chapter where ch_id = #{ch_id}")
    String findChapterfilename(String ch_id);

    @Select("select b_name from t_book,t_chapter where t_book.b_id = t_chapter.b_id and ch_id = #{ch_id}")
    String findChapterbookname(String ch_id);

    @Select("select `level` from t_price")
    List<String> findLevel();

    @Select("select * from t_class")
    List<Classification> findClass();
}
